package com.qf.cosmetology.controller;

import com.qf.cosmetology.result.ResponseCode;
import com.qf.cosmetology.result.ResponseData;
import com.qf.cosmetology.service.PicService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Api("PicApi")
@RestController
@RequestMapping("pics")
public class PicController {

    @Autowired
    private PicService picService;

    @ApiOperation(value = "queryByType",notes = "通过图片类型获取对应的轮播图片或者是导航图片")
    @ApiImplicitParam(name = "type",value = "图片的类型")
    @GetMapping("/{type}")
    public ResponseData queryByType(@PathVariable String type){
        return picService.queryByType(type);
    }

    @GetMapping("/v1/{id}")
    public ResponseData queryById(@PathVariable Integer id){
        return new ResponseData(ResponseCode.SUCCESS,picService.queryById(id));
    }





}
